import {mapGetters} from 'vuex'

export default {
  computed: {
    ...mapGetters('m_cart', ['addedCount']),
  },
  data() {
    return {
    };
  },
  
  //页面挂载完毕时调用方法为tabBar页面设置徽标
  onShow() {
    this.setBadge();
  },

  methods: {
    setBadge() {
      uni.setTabBarBadge({
        index: 2,
        text: this.addedCount+ '',
      })
    },
  },
  watch:{
    addedCount(newVal){
       this.setBadge();
    }
  },
  
}